<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>画圆</title>
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=5SalGXgIc1ixWAbWja05e9s5"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/DistanceTool/1.2/src/DistanceTool_min.js"></script>
<script type="text/javascript">
function GetRequest() {
	   var url = parent.location.search; //获取url中"?"符后的字串
	   var theRequest = new Object();
	   if (url.indexOf("?") != -1) {
	      var str = url.substr(1);
	      strs = str.split("&");
	      for(var i = 0; i < strs.length; i ++) {
	         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
	      }
	   }
	   return theRequest;
	}
function init(){
	var Request=GetRequest();
	var dBi=15;//天线增益
	var DP=41;//损耗值
	var P2=Request['bcgl'];//标称功率
	var dBd=dBi-2.15;
	var G = Math.pow(10,dBd/10.00);
	var P = Math.pow(10,(P2-DP)/10.00);
	var APd1=(P*G/(4*Math.PI*(100*100)))*100;
	var APd2=(P*G/(4*Math.PI*(200*200)))*100;
	var APd3=(P*G/(4*Math.PI*(300*300)))*100;
	// 百度地图API功能
	var map = new BMap.Map("allmap");
	var point = new BMap.Point(Request['jd'],Request['wd']);
	map.centerAndZoom(point, 16);
	var marker = new BMap.Marker(point);  // 创建标注
	map.addOverlay(marker);              // 将标注添加到地图中
	marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
	//添加缩放控件
	map.addControl(new BMap.NavigationControl());
	//启用滚轮放大缩小，默认禁用
	map.enableScrollWheelZoom();
	//启用地图惯性拖拽，默认禁用
	map.enableContinuousZoom();
	//左上角，默认地图控件
	map.addControl(new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP,BMAP_HYBRID_MAP]}));
	
	map.setCurrentCity("武汉");
	var circle1 = new BMap.Circle(point,100);
	circle1.setStrokeColor("red");
	circle1.setStrokeWeight(2);
	circle1.setFillOpacity(0.2);
	circle1.disableMassClear(); 
	circle1.addEventListener('mouseover',function(e){
		map.clearOverlays();
		map.addOverlay(marker);              // 将标注添加到地图中
		marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
		var opts = {
				  position : e.point,    // 指定文本标注所在的地理位置
				  offset   : new BMap.Size(0,0)    //设置文本偏移量
				};
		var label = new BMap.Label("100m Pd"+APd1.toFixed(3)+"(μW/c㎡)", opts);  // 创建文本标注对象
			label.setStyle({
				 color : "red",
				 fontSize : "12px",
				 height : "20px",
				 lineHeight : "20px",
				 fontFamily:"微软雅黑"
			 });
		map.addOverlay(label);
	});
	circle1.enableEditing();
	map.addOverlay(circle1);
	var circle2 = new BMap.Circle(point,200);
	circle2.setStrokeColor("orange");
	circle2.setStrokeWeight(2);
	circle2.setFillOpacity(0.2);
	circle2.disableMassClear();
	circle2.addEventListener('mouseover',function(e){
		map.clearOverlays();
		map.addOverlay(marker);              // 将标注添加到地图中
		marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
		var opts = {
				  position : e.point,    // 指定文本标注所在的地理位置
				  offset   : new BMap.Size(0,0)    //设置文本偏移量
				};
		var label = new BMap.Label("200m Pd"+APd2.toFixed(3)+"(μW/c㎡)", opts);  // 创建文本标注对象
			label.setStyle({
				 color : "orange",
				 fontSize : "12px",
				 height : "20px",
				 lineHeight : "20px",
				 fontFamily:"微软雅黑"
			 });
		map.addOverlay(label);
	});
	map.addOverlay(circle2);
	var circle3 = new BMap.Circle(point,300);
	circle3.setStrokeColor("green");
	circle3.setStrokeWeight(2);
	circle3.setFillOpacity(0.2);
	circle3.disableMassClear();
	circle3.addEventListener('mouseover',function(e){
		map.clearOverlays();
		map.addOverlay(marker);              // 将标注添加到地图中
		marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
		var opts = {
				  position : e.point,    // 指定文本标注所在的地理位置
				  offset   : new BMap.Size(0,0)    //设置文本偏移量
				};
		var label = new BMap.Label("300m Pd"+APd3.toFixed(3)+"(μW/c㎡)", opts);  // 创建文本标注对象
			label.setStyle({
				 color : "green",
				 fontSize : "12px",
				 height : "20px",
				 lineHeight : "20px",
				 fontFamily:"微软雅黑"
			 });
		map.addOverlay(label);
	});
	map.addOverlay(circle3);
	}
</script>
</head>
<body onload="init()">
<div id="allmap"></div>
</body>
</html>